hisi_183x_sources = files(
  'hi183x_abi.cpp',
  'hi183x_card.cpp',
  'hi183x_om.cpp',
  'hi183x_port.cpp',
) + interface_sources

libhisi_183x_static = static_library(
  'hisi_183x',
  hisi_183x_sources,
  include_directories: include_dirs + hisi_interface_inc,
  dependencies: [dev_deps, libncsi_over_mctp_dep, libmctp_dep, libimu_dep, libsmbus_dep],
  install: false,
)

libhisi_183x = shared_library(
  'hisi_183x',
  include_directories: include_dirs + hisi_interface_inc,
  name_prefix: 'lib',
  name_suffix: 'so',
  install: true,
  install_dir: drivers_install_dir,
  link_whole: [libhisi_182x_static],
)

if build_tests
  hisi_183x_dep = declare_dependency(
    include_directories: include_dirs + hisi_interface_inc,
    link_with: libhisi_183x_static,
    dependencies: [
      libmcpp_deps,
      libncsi_over_mctp_dep,
      libmctp_dep,
      libimu_dep,
      libsmbus_dep,
    ],
  )
endif

if build_tests and meson_build
  custom_target(
    'copy_libhisi_183x',
    output: 'copy_libhisi_183x',
    command: ['cp', libhisi_183x.full_path(), drivers_install_dir],
    depends: libhisi_183x,
    build_by_default: true,
  )
endif